package cn.myjerry.sort.col;

import java.util.TreeSet;

public class TreeSetDemo {
	public static void main(String[] args) {
		Person p1 = new Person("张学友",150);
		Person p2 = new Person("周杰伦",80);
		Person p3 = new Person("成龙",110);
		Person p4 = new Person("房祖名",100);
		
		TreeSet<Person> persons = new TreeSet<Person>(
				new java.util.Comparator<Person>(){
					@Override
					public int compare(Person o1, Person o2) {
						return o1.getHandsome() - o2.getHandsome();
					}}
				);
		persons.add(p1);
		persons.add(p2);
		persons.add(p3);
		persons.add(p4);
		System.out.println(persons);
	}
}
